package cn.sciento.transfer.infra.repository.impl;

import cn.sciento.core.domain.Page;
import io.choerodon.mybatis.pagehelper.PageHelper;
import io.choerodon.mybatis.pagehelper.domain.PageRequest;
import java.util.List;
import cn.sciento.mybatis.base.impl.BaseRepositoryImpl;
import cn.sciento.transfer.api.dto.ProducerConfigDTO;
import cn.sciento.transfer.domain.entity.ProducerConfig;
import cn.sciento.transfer.domain.repository.ProducerConfigRepository;
import cn.sciento.transfer.infra.mapper.ProducerConfigMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ProducerConfigRepositoryImpl extends BaseRepositoryImpl<ProducerConfig> implements ProducerConfigRepository {
  @Autowired
  private ProducerConfigMapper producerConfigMapper;
  
  public Page<ProducerConfig> listProducerConfig(PageRequest pageRequest, ProducerConfigDTO producerConfig) {
    return PageHelper.doPageAndSort(pageRequest, () -> this.producerConfigMapper.listProducerConfig(producerConfig));
  }
  
  public ProducerConfig selectProducerConfig(Long producerConfigId) {
    return this.producerConfigMapper.selectProducerConfig(producerConfigId);
  }
}
